package networkSimulation.simulation.virus

import networkSimulation.framework.{Edge, UndirectedGraph}
import java.lang.reflect.Method

/**
 * Custom implementation of a Virus graph.
 *
 * @author  Tim Caljé
 *          Jeroen De Raedt
 *          Jorick Van Aken
 */
class VirusGraph extends UndirectedGraph[InfectablePerson,Edge[InfectablePerson]] {

  /**
   * Monitor for dead nodes
   */
  private val deadMonitor = new DeadMonitor[Method, InfectablePerson#Pub]("Infected Monitor", this)

  /**
   * Get the name of the this graph type
   * @return  The string name of this graph type
   */
  @Override
  override def getGraphType() : String = "VirusGraph"

  /**
   * Overrides the method for adding a node to the graph by adding a subscriber to it
   */
  @Override
  override def addNode(node : InfectablePerson) {
    super.addNode(node)
    node.subscribe(deadMonitor)
  }

}